﻿using CarAppDto.Base;
using FluentValidation;

namespace CarAppDto.Rule.RuleConfigDtos
{
    /// <summary>
    ///数据校验类要继承自 AbstractValidator
    ///通过 AbstractValidator 的泛型参数指定对哪个类进行校验
    /// </summary>
    public class ReqAddRuleMappingValidator : AbstractValidator<ReqAddRuleMapping>
    {
        /// <summary>
        /// 校验规则写到校验类的构造方法中
        /// </summary>
        public ReqAddRuleMappingValidator()
        {       
            RuleFor(x => x.RuleId).NotEmpty();
            RuleFor(x => x.Details).NotEmpty();
        }
    }

    /// <summary>
    /// 添加规则组成
    /// </summary>
    public class ReqAddRuleMapping : BaseAddModel
    {


        /// <summary>
        /// 规则ID
        /// </summary>

        public string? RuleId { get; set; }


        public RuleMappingValue? KeyValue { get; set; } = null;
        /// <summary>
        /// 描述
        /// </summary>

        public string? Descption { get; set; }
        /// <summary>
        /// 值
        /// </summary>

        public RuleMappingDetails? Details { get; set; }

        /// <summary>
        ///  正则匹配字符串
        /// </summary>
        public string? RegStr { get; set; } = null;
    }
}
